package com.emns.web.mobile;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import com.emns.pojo.YueduScore;
import com.emns.service.mobile.YueduScoreMobileService;

@Controller
@RequestMapping(value = "/yueduScoreMobile")
public class YueduScoreMobileController {

	@Autowired
	YueduScoreMobileService ysms;

	//
	@RequestMapping(value = "/add")
	public void addComment(Model model, YueduScore ys) {
		int flag = ysms.addYueduScore(ys);
		String errCode = "";
		String errMsg = "";
		if (flag == 405) {
			errCode = "3";
			errMsg = "不能重复评分";
		} else if (flag == 1) {
			errCode = "1";
			errMsg = "插入失败";
		} else if (flag == 200) {
			errCode = "0";
			errMsg = "插入成功";
		}
		model.asMap().remove("yueduScore");
		model.addAttribute("errorCode", errCode);
		model.addAttribute("errorMessage", errMsg);
		model.addAttribute("info", "");
	}
}
